/**
 * immutable 的一个 库 immer
 *
 */
import { useSelector, useDispatch } from "react-redux";

// 引入对应的动作创建函数
import { add, jian, add10, add20, addByNum } from "./store/action-creator";

export default function App() {
  const count = useSelector((state: any) => state.count);
  const dispatch = useDispatch();

  return (
    <div>
      <h1>App - {count}</h1>
      <hr />
      <button onClick={() => dispatch(add())}>Add</button>
      <button onClick={() => dispatch(jian())}>Jian</button>

      <button onClick={() => dispatch(addByNum(10))}>Add + 10</button>
      <button onClick={() => dispatch(addByNum(20))}>Add + 20</button>
    </div>
  );
}
